#ifndef xpack_utils_bytes_array_wrapper
#define xpack_utils_bytes_array_wrapper
#pragma push_macro("xuser")
#undef  xuser
#define xuser mixc::utils_bytes_array_wrapper::inc
#include"define/base_type.hpp"
#include"macro/xexport.hpp"
#include"macro/xforward_constructor.hpp"
#include"macro/xmodify.hpp"
#include"macro/xstruct.hpp"
#include"meta/item_origin_of.hpp"
#include"interface/unified_seq.hpp"
#pragma pop_macro("xuser")

namespace mixc::utils_bytes_array_wrapper{
    template<inc::can_unified_seqlize seq_t>
    xstruct(
        xtmpl(bytes_array_wrapper, seq_t),
        xprib(seq_t)
    )
    public:
        using origin_item_t = inc::item_origin_of<seq_t>;
        using item_t        = u08;
        using final_t       = seq_t;
        using seq_t::seq_t;
    public:
        xprops()
            xpubgetx(length, uxx){
                xr{ return xthex->length * sizeof(origin_item_t) / sizeof(u08); }
            };
        $

        xprops_operator()

    public:
        xforward_constructor(bytes_array_wrapper, seq_t)

        u08 & operator[](uxx i) const {
            uxx i_slot      = i / sizeof(origin_item_t);
            uxx i_bytes     = i % sizeof(origin_item_t);

            // 注意：不支持大端模式
            return u08p(xmodify(seq_t::operator[](i_slot)))[i_bytes];
        }
    $
}

#endif

xexport(mixc::utils_bytes_array_wrapper::bytes_array_wrapper)